//
//  ViewController.swift
//  CommandPattern
//
//  Created by aron on 2017/6/4.
//  Copyright © 2017年 aron. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // 命令模式测试1
        let receiver = YT_Receiver()
        let command = YT_ConcreteCommand(receiver: receiver)
        let invoker = YT_Invoker(command: command)
        invoker.action()
        
        // 命令模式测试2
        let computer = YT_Computer()
        let startupCommand = YT_StartupCommand(receiver: computer)
        let shutdownCommand = YT_ShutdownCommand(receiver: computer)
        let computerInvoker = YT_ComputerInvoker(startupCommand: startupCommand, shutdownCommand: shutdownCommand)
        computerInvoker.startup()
        computerInvoker.shutdown()
        
        
        for _ in 1...100 {
            print("6")
        }
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

